#include "stm32f0xx_conf.h"
#include "stm32f0xx_gpio.h"
#include "stm32f0xx.h"
#include "keypad.h"



int keypadwrite(void)

{ 

while(1)
{ 
GPIOC->BSRR = GPIO_Pin_5;//set bit as high
GPIOB->BRR = GPIO_Pin_0;//set bit as low
GPIOB->BRR = GPIO_Pin_1;//set bit as low
{ 
if(GPIO_ReadInputDataBit(GPIOB, GPIO_Pin_12))//read input bit PB12
display(3);
if(GPIO_ReadInputDataBit(GPIOB, GPIO_Pin_11)) //read input bit PB11
display(6);
if(GPIO_ReadInputDataBit(GPIOB, GPIO_Pin_10)) //read input bit PB10
display(9);
if(GPIO_ReadInputDataBit(GPIOB, GPIO_Pin_2)) //read input bit PB2
display(11);
}
GPIOC->BRR = GPIO_Pin_5;//set bit as low
GPIOB->BSRR = GPIO_Pin_0;//set bit as high
GPIOB->BRR = GPIO_Pin_1;//set bit as low
{ 
if(GPIO_ReadInputDataBit(GPIOB, GPIO_Pin_12)) 
display(2);
if(GPIO_ReadInputDataBit(GPIOB, GPIO_Pin_11))
display(5);
if(GPIO_ReadInputDataBit(GPIOB, GPIO_Pin_10))
display(8);
if(GPIO_ReadInputDataBit(GPIOB, GPIO_Pin_2))
display(0);

} 
GPIOC->BRR = GPIO_Pin_5;//set bit as low
GPIOB->BRR = GPIO_Pin_0;//set bit as low
GPIOB->BSRR = GPIO_Pin_1;//set bit ashigh 
{
if(GPIO_ReadInputDataBit(GPIOB, GPIO_Pin_12))
display(1);
if(GPIO_ReadInputDataBit(GPIOB, GPIO_Pin_11))
display(4);
if(GPIO_ReadInputDataBit(GPIOB, GPIO_Pin_10))
display(7);
if(GPIO_ReadInputDataBit(GPIOB, GPIO_Pin_2))
display(10);

}


}


}